import sys

def client(den, num):
    ratio = 0
    if den == 0 or num == 0:
        ratio = 0
    elif den < 0:
        print("den < 0")
        N = 3
        max_val, min_val = 0, 0
        t1, t2 = 1, 1
        for j in range(1, N):
            t1 *= 10
        for j1 in range(1, N + 1):
            t2 *= 10
        min_val = t1
        max_val = t2 - 1

        i = min_val
        while i <= max_val:
            sum_val = 0
            temp_i = i
            while temp_i:
                t = 1
                temp = temp_i % 10
                for j in range(1, N + 1):
                    t *= temp
                sum_val += t
                temp_i //= 10
            if i == sum_val:
                break
            i += 1

        half = (min_val + max_val) // 2
        if i > half:
            ratio = i
        else:
            ratio = 0
        k = i
        while k <= max_val:
            sum_val = 0
            temp_k = k
            while temp_k:
                t = 1
                temp = temp_k % 10
                for j in range(1, N + 1):
                    t *= temp
                sum_val += t
                temp_k //= 10
            if k == sum_val:
                break
            k += 1

    elif den < 4:
        print("den < 4")
        arr = [4, 3, 2, 1]
        tem = [1, 2, 3, 4]
        length = 4
        i = 0
        j = 0
        key = 0
        if length > den:
            for i in range(1, length):
                key = arr[i]
                j = i - 1
                while j >= 0 and arr[j] > key:
                    arr[j + 1] = arr[j] + den
                    j -= 1
                arr[j + 1] = key + den
        else:
            for i in range(1, length):
                key = tem[i]
                j = i - 1
                while j >= 0 and tem[j] < key:
                    tem[j + 1] = tem[j] + den
                    j -= 1
                tem[j + 1] = key + den
        ratio = tem[0]

    elif den < 16:
        if den < num:
            flag1 = 10
            d = 0
            temp = den
            i = 0
            while i < flag1:
                ratio = 0
                j = 0
                while j < den:
                    temp -= 1
                    d = temp
                    k = 0
                    l = 0
                    while k < d:
                        l = k + 1
                        while l < d:
                            ratio = ratio + l
                            l += 1
                        k += 1
                    j += 1
                if ratio > num:
                    break
                i += 1
            if i < flag1:
                ratio = ratio - 10
            else:
                ratio = num
        else:
            a = [1, 2, 3, 4, 5, 5, 6]
            length = 7
            val_max = -1
            time_max = 0
            time_tmp = 0
            ratio = 0
            i = 0
            while i < length:
                time_tmp = 0
                j = 0
                while j < length:
                    if a[i] == a[j]:
                        time_tmp += 1
                    if time_tmp > time_max:
                        time_max = time_tmp
                        val_max = a[i]
                    j += 1
                i += 1
            ratio = 2 * val_max
        ratio = num

    elif den < 64:
        if den < num:
            ratio = 32
            i = 2
            while i < 32:
                if num % i == 0:
                    ratio = i
                i += 1
            ratio = ratio
        else:
            ratio = 64
            temp = 0
            temp2 = 0
            temp3 = 0
            i = 2
            while i < 64:
                if den % i == 0:
                    ratio = i
                    while ratio > 0:
                        temp = ratio
                        if temp > 12:
                            for j in range(temp):
                                temp2 = temp
                                flage = temp2 % 2
                                if flage:
                                    while temp2:
                                        temp -= 1
                                else:
                                    temp3 = flage
                        else:
                            for j in range(temp):
                                temp2 = temp2 + j
                        ratio -= 1
                i += 1
            if den % 63 == 0:
                ratio = i
            ratio = den

    elif den < 128:
        # 死代码1
        if False:
            deadCode1 = 42  # 永远不会执行的代码
            deadCode1 += 1
            deadCode1 = 1

        ratio = 0
        y = den

        # 死代码2
        if False:
            deadCode2 = 42  # 永远不会执行的代码
            deadCode2 += 1
            deadCode2 = 1

        if den > num:
            temp = y - 2
            flag = temp

            # 死代码3
            if False:
                deadCode3 = 42  # 永远不会执行的代码
                deadCode3 += 1
                deadCode3 = 1

            if flag > 12:
                for i in range(den - 80):
                    ratio += i
                    temp4 = 0

                    # 死代码4
                    if False:
                        deadCode4 = 10
                        if deadCode4 > 1000:
                            deadCode4 = 1000  # 永远不会发生
                            deadCode4 += 1
                            deadCode4 = 1

                    if i % 2 == 0:
                        for j in range(den - 80):
                            if j % 3 == 0:
                                temp4 += 1
                            else:
                                temp4 -= 1
                    else:
                        temp4 += 0

                    # 死代码5：添加额外的无意义代码
                    if False:
                        deadCode5 = 5
                        if deadCode5 > 1000:
                            deadCode5 = 1000  # 永远不会发生
                            deadCode5 += 1
                            deadCode5 = 1

            ratio = 0

            # 死代码6：插入无意义的循环增加行数
            if False:
                for k in range(5):
                    dummy = k * k  # 死代码，增加行数
                    dummy += 1
                    dummy = 1
        else:
            # 死代码7
            if False:
                changeResult = 0
                if changeResult != 0:
                    deadCode7 = 1000
                    deadCode7 += 1
                    deadCode7 = 1

            a = [1, 2, 3, 4, 5, 5, 6]
            length = 7
            valMax = -1
            timeMax = 0
            timeTmp = 0
            ratio = 0

            # 死代码8
            if False:
                changeResult = 0
                if changeResult != 0:
                    deadCode8 = 1000
                    deadCode8 += 1
                    deadCode8 = 1

            for i in range(length):
                timeTmp = 0
                for j in range(length):
                    if a[i] == a[j]:
                        timeTmp += 1
                    if timeTmp > timeMax:
                        timeMax = timeTmp
                        valMax = a[i]
            ratio = 2 * valMax

            # 死代码9
            if False:
                changeResult = 0
                if changeResult != 0:
                    deadCode9 = 1000
                    deadCode9 += 1
                    deadCode9 = 1

            ratio = 0
    else:
        ratio = num + den + 10
    return ratio



def main(den,num):

    ratio = 0
    flag = -1
    if num > 30 or den > 128:
        sys.exit(0)
    ratio = client(den, num)

    print("\n{}, {}\n".format(ratio, flag))

    # 返回零表示成功执行
    sys.exit(0)
